if(typeof String.prototype.trim !== 'function') {
  String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, ''); 
  }
}

Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('GBIF', 'resources/js');

Ext.require(['*']);

Ext.getUrlParam = function(param) {
	var params = Ext.urlDecode(location.search.substring(1));
	return param ? params[param] : params;
};

Ext.onReady(function(){

	Ext.tip.QuickTipManager.init();
	Ext.fly(document.body).on('contextmenu', function(e, target) {
		e.preventDefault();
	});

	lang = Ext.getUrlParam('lang');
	GBIF.tmpProjectID = Ext.getUrlParam('projectID');
	if(!lang){
		lang = 'en';
	};

	var view = Ext.create('GBIF.MainViewport', {
			renderTo: Ext.getBody()
	});
	Ext.get('loading').remove();
	Ext.get('loading-mask').fadeOut({ remove: true });
	
});